<template>
	<view class="category-manage">
		<scroll-view class="category-manage-view" scroll-y :refresher-enabled="true" :refresher-threshold="70" @refresherrefresh="onRefresh" :refresher-triggered="isRefresh" @refresherrestore="onRestore">
			<view class="category-manage-list">
				<view class="category-item" v-for="(data,index) in categoryList" :key="index" @click="goProductManage(data.style_id)">
					<view class="category-item-name">{{data.name}}</view>
					<view class="category-item-right">
						<view class="category-item-number" v-if="!manage">10个案例<image src="https://master.shengejiaju.cn/web/static/icons/ico_more_goods@2x.png"></image></view>
						<view class="category-item-action" v-else>
							<view class="del" @click.stop="del(data.id)">删除</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<!-- <view class="category-manage-bottom">
			<view v-if="!manage" @click="edit()"><image src="https://master.shengejiaju.cn/web/static/icons/ico_add@2x.png"></image>添加分类</view>
			<view v-if="!manage" @click="manageFun"><image src="https://master.shengejiaju.cn/web/static/icons/ico_edit@2x.png"></image>管理分类</view>
			<view class="complete" @click="complete" v-else>完成</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isRefresh: false,
				manage: false,
				categoryList: []
			};
		},
		methods:{
			del(){
				uni.showModal({
					content: '是否删除此分类？',
					success(res) {
						if(res.confirm){
							uni.showToast({
								icon: 'none',
								title: '删除成功'
							})
						}
					}
				})
			},
			manageFun(){
				this.manage = true
			},
			complete(){
				this.manage = false
			},
			goProductManage(id){
				uni.navigateTo({
					url: '/pages/case-manage/case-manage?style_id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
	@import  '../../static/scss/category-manage.scss'
</style>